<template>
  <a-modal
    title="新增客户"
    :width="640"
    :visible="visible"
    :confirmLoading="loading"
    @ok="() => { $emit('ok') }"
    @cancel="() => { $emit('cancel') }"
  >
    <a-spin :spinning="loading">
      <a-form :form="form" v-bind="formLayout">
        <a-form-item label="客户名称">          
          <a-input v-decorator="['name', {rules: [{required: true, message: '请输入客户名称！'}]}]" />
        </a-form-item>
        <a-form-item label="客户标识">
          <a-input v-decorator="['clientSystem', {rules: [{required: true, message: '请输入客户标识！'}]}]" />
        </a-form-item>
      </a-form>
    </a-spin>
  </a-modal>
</template>

<script>
import pick from 'lodash.pick'
import Bus from '@/components/vue-simple-uploader/js/bus'
import GlobalUploader from '@/components/vue-simple-uploader/GlobalUploader'
import { mergeSimpleUpload,getQNToken } from '@/api/updata'
import * as qiniu from 'qiniu-js'

// 表单字段
const fields = ['description', 'id']

export default {
  components: {
    GlobalUploader
  },
  props: {
    visible: {
      type: Boolean,
      required: true
    },
    loading: {
      type: Boolean,
      default: () => false
    },
    model: {
      type: Object,
      default: () => null
    }
  },
  data () {
    this.formLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 7 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 13 }
      }
    }
    return {
      form: this.$form.createForm(this),

      platformList:[],
      MemoryList:[8,16,32],
    }
  },
  created () {
    console.log('custom modal created')

    // 防止表单未注册
    fields.forEach(v => this.form.getFieldDecorator(v))

    // 当 model 发生改变时，为表单设置值
    this.$watch('model', () => {
      this.model && this.form.setFieldsValue(pick(this.model, fields))
    })
  },
  mounted() {

  },

  beforeDestroy() {

  },

  methods: {
    
  },
}
</script>
